Given an array A[] of size N and an integer K, find minimum number of operations to make maximum element of every subarray of size K at least X. In one operation, we can increment any element of the array by 1....
Given an array A[] of length N. Consider that purchasing ith item will cost Ai and then next i number of item(s) will be free to collect. Then your task is to output the minimum cost to collect all items at least once....
Given a binary string S of size N, and a 2D array Q[][] of queries consisting of M pairs of the form {L, R}, the task for each query is to find the maximum number of 0s lying between two 1s in the range [L, R].Examples:...
Given an array arr[] consisting of N integers and an integer K, the task is to find the minimum sum of incompatibilities of K subsets of equal sizes having unique elements....
Given a positive integer K and a matrix arr[][] of dimensions N*M consisting of integers, the task is to find the maximum sum of K elements possible from the given matrix....
Given a positive integer N, the task is to find the number of N-digit numbers such that every digit is smaller than its adjacent digits....
Given an array arr[] consisting of N positive integers, the task is to find the length of the longest subarray having a product of elements of that subarray equal to a perfect power of 2....
Given an array balls[] representing the count of colored balls labeled from 1 to k, the task is to determine the number of ways to draw the last ball of color i before drawing the last ball of color i + 1 for all i from 1 to k – 1....
Given an integer N, the task is to tile a board of dimensions N * 1 the task is to count the number of ways to tile a board using tiles of dimensions 1 * 1 and 2 * 1....
Given an integer matrix mat[][] of dimensions N * M, the task is to print the maximum product of matrix elements in the path from the top-left cell (0, 0) to the bottom-right cell (N – 1, M – 1) of the given matrix. Only possible moves from any cell (i, j) is (i + 1, j) or (i, j + 1). If the maximum product is negative, then print “-1”....
Given two integer N and K, the task is to find the number of sequence of length K consisting of values from the range [1, N], such that every (i + 1)th element in the sequence is divisible by its preceding ith element....
Given two numbers x, y which denotes the number of set bits. Also given is a number C. The task is to print the number of ways in which we can form two numbers A and B such that A has x number of set bits and B has y number of set bits and A+B = C.Examples:...